<?php
/**
 * NodeController.class.php - 权限控制器
 * @package Controller
 * @subpackage null
 * @link http://www.xxx.com
 * @author xxx PHP DEV TEAM JiRY(390066398@qq.com)
 * @copyright 2016-10-28 9:40
 */
namespace Admin\Controller;
use Admin\Controller\CommonController;
class NodeController extends CommonController {
	/**
	 * 权限节点列表
	 */
	public function index(){
            // 检索条件
            $map	= [];

            // 分页数据
            $page = self::$CommonLogic->apiPage([
                'table'     => 'auth_rule',
                'where'     => $map,
                'order'     => 'id asc'
            ]);
            
            foreach($page['data'] as &$v){
                // 所属系统
                $v['sys_type_name']     = get_field_status('AUTH_RULE', 'SYS_TYPE', $v['sys_type']);
                // 上级节点名称
                $v['pid_name']          = _default(self::$CommonLogic->getField('auth_rule', 'title', ['id' => $v['pid'], 'status'=>['neq', 99]]));
                // 节点路径名称
                $v['pid_path_name']     = _default(get_node_path(['pid_path' => $v['pid_path']]));
                // ICON图标
                $v['icon_name_str']     = $v['icon_name'] ? '<i class="'.$v['icon_name'].'"></i>' : _default();
                // 类型名称
                $v['type_name']         = get_field_status('AUTH_RULE', 'TYPE', $v['type']);
                // 附加条件
                $v['condition']         = _default($v['condition']);
                // 状态
                $v['status_name']       = get_field_status('AUTH_RULE', 'STATUS', $v['status']);
                // 是否显示
                $v['is_show_name']      = get_field_status('AUTH_RULE', 'IS_SHOW', $v['is_show']);
            }
            
            self::$result   = array_merge(self::$result, $page);
            //$this->ajaxReturnSuccess(self::$result);
            $this->ajaxReturn(self::$result);
        }
}